﻿//注意要在控件加载完之后调用,建议放到插件onload事件中初始化（<param name="onLoad" value="pluginLoaded" />）
$.CmjUpload = function (options) {
    var uploader = null;
    if (options.hasOwnProperty("id")) {//组件id
        uploader = document.getElementById(options.id);
        alert(options.id);
    } else {
        alert("Please configure the id attribute before use CmjUpload component！");
        return;
    }

    //alert(options.hasOwnProperty("requestUrl"));
    if (options.hasOwnProperty("requestUrl")) {//请求的url
        uploader.content.cmjUpload.RequestUrl = options.requestUrl;
        alert(options.requestUrl);
    } else {
        alert("Please configure the requestUrl attribute before use CmjUpload component！");
        return;
    }
    if (options.hasOwnProperty("fileTypes")) {//文件类型限制
        uploader.content.cmjUpload.FileTypes = options.fileTypes;
        alert(options.fileTypes);
    }
    if (options.hasOwnProperty("limitCount")) {//每批次上传的文件数
        uploader.content.cmjUpload.LimitCount = options.limitCount;
        alert(options.limitCount);
    }
    if (options.hasOwnProperty("limitSize")) {//单个文件大小限制
        uploader.content.cmjUpload.LimitSize = options.limitSize;
        alert(options.limitSize);
    }
}
CmjUpload.prototype.onBeforeFileUpload = function () {//单个文件上传之前执行
    
}

CmjUpload.prototype.onFileUploading = function () { //单个文件上传时执行
    
}

CmjUpload.prototype.onFileUploaded = function () {//单个文件上传完毕执行

}

CmjUpload.prototype.onBatchUploaded = function () {//整个批次的文件上传完毕执行

}